/*
Disclaimer of Warranty: THE PACKAGE
IS PROVIDED BY THE COPYRIGHT HOLDER
AND CONTRIBUTORS "AS IS' AND WITHOUT
ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR
WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(c) Copyright 2013 Edward Principe
All Rights Reserved
*/
#ifndef INTERNALERROR_H
#define INTERNALERROR_H

#include <Windows.h>
#include <tchar.h>
#include <string>
#include <cstring>
#include "rte.h"

///////////////////////////////////////////////////////////////////
// InternalError: Used for Internal Errors. Things that
//                shouldn't happen
//////////////////////////////////////////////////////////////////
class InternalError : public RTE
{
public: // Methods
	InternalError()
	{
		Set();
	}

	InternalError(const TCHAR *msg)
	{
		Set(msg);
	}

public: // Methods
	void Set(const TCHAR *msg = NULL)
	{
		// If msg is NULL; use default
		if (msg == NULL)
		{
			RTE::PutErr(ERR_INTERNAL);
			return;
		}

		// Get the message
#ifdef _UNICODE
		wstring str_msg = msg;
#else
		string str_msg = msg;
#endif

		// Set the error to the class
		_err = ERR_INTERNAL;
		_sev = SEV_FATAL;
		_msg = TEXT("Internal Error: ") + str_msg;

	}
	
};
#endif